﻿@model HCQ2_Model.ViewModel.SysAdmin.UserModel
@using HCQ2_Model
@using NUnit.Framework
@{
    ViewBag.Title = "用户管理";
}
@section headerSection{
    <style>
     .float-unit {
        height: 100%;
        border: 1px solid #E7EAEC;
        border-top-width: 0px;
        border-bottom-width: 0px;
        margin-bottom: 0px;
    }

    .left-sm-3 {
        padding-left: 0px;
    }

    .right-sm-9 {
        padding-right: 0px;
    }

    .ibox-unit {
        overflow-y: auto;
        height: 89%;
        padding: 0px;
    }

    #exampleToolbar div {
        margin-bottom: 0px;
    }

    #exampleToolbar > .form-group {
        float: left;
        margin: 0;
        margin-right: 5px;
        margin-top: 1px;
    }

    .form-group > button {
        margin-top: -2px;
        margin-bottom: 2px;
    }
    </style>
}
<div class="wrapper animated fadeInRight autoHeight">
    <!-- Panel Other -->
    <div class="row autoHeight" style="background-color: #fff;">
        <!--选择区域-->
        @*<div id="tree"></div>*@
        <div id="userContext" class="col-sm-12 col-sm-leftRight" style="padding-left: 5px; margin-top: 2px;">
            <!-- Example Toolbar -->
            <div class="example">
                <div class="btn-group hidden-xs" id="exampleToolbar" role="group">
                    <div class="form-group form-inline" style="width:100%;">
                        @{
                            List<string> folderList = (List<string>)ViewBag.elementList;
                            if (folderList.Contains("userDetail"))
                            {
                                <button id="userDetail" type="button" class="btn btn-outline btn-primary">
                                    <i class="glyphicon glyphicon-th-large" aria-hidden="true">详细</i>
                                </button>
                            }
                            if (folderList.Contains("userAdd"))
                            {
                                <button id="userAdd" type="button" class="btn btn-outline btn-primary">
                                    <i class="glyphicon glyphicon-plus" aria-hidden="true">添加</i>
                                </button>
                            }
                            if (folderList.Contains("batchAdd"))
                            {
                                <button id="batchAdd" type="button" class="btn btn-outline btn-primary">
                                    <i class="glyphicon glyphicon-th-list" aria-hidden="true">批量添加</i>
                                </button>
                            }
                            if (folderList.Contains("userEdit"))
                            {
                                <button id="userEdit" type="button" class="btn btn-outline btn-primary">
                                    <i class="glyphicon glyphicon-pencil" aria-hidden="true">编辑</i>
                                </button>
                            }
                            if (folderList.Contains("userDel"))
                            {
                                <button id="userDel" type="button" class="btn btn-outline btn-danger">
                                    <i class="glyphicon glyphicon-trash" aria-hidden="true">删除</i>
                                </button>
                            }
                            if (folderList.Contains("userImport"))
                            {
                                <button id="userImport" type="button" class="btn btn-outline btn-primary">
                                    <i class="glyphicon glyphicon-pencil" aria-hidden="true">批量导入</i>
                                </button>
                            }
                            if (folderList.Contains("btnActId"))
                            {
                                <div class="form-group" style="margin-top:-2px;">
                                    <button id="btnActId" class="btn btn-primary" type="button">
                                        <i class="fa fa-heart"></i>&nbsp;激活
                                    </button>
                                </div>
                            }
                            if (folderList.Contains("btnUserGroup"))
                            {
                                <div class="form-group" style="margin-top:-2px;">
                                    <button id="btnUserGroup" class="btn btn-primary" type="button">
                                        <i class="fa fa-group"></i>&nbsp;分配用户组
                                    </button>
                                </div>
                            }
                            if (folderList.Contains("btnRole"))
                            {
                                <div class="form-group" style="margin-top:-2px;">
                                    <button id="btnRole" class="btn btn-primary" type="button">
                                        <i class="fa fa-user"></i>&nbsp;分配角色
                                    </button>
                                </div>
                            }
                            if (folderList.Contains("btnBatchRole"))
                            {
                                <button id="btnBatchRole" type="button" class="btn btn-primary">
                                    <i class="fa fa-group" aria-hidden="true">批量新增角色</i>
                                </button>
                            }
                            if (folderList.Contains("btnBatchModifyRole"))
                            {
                                <button id="btnBatchModifyRole" type="button" class="btn btn-primary">
                                    <i class="fa fa-group" aria-hidden="true">批量更新角色</i>
                                </button>
                            }
                            if (folderList.Contains("btnBatchStart"))
                            {
                                <button id="btnBatchStart" type="button" class="btn btn-primary">
                                    <i class="fa fa-group" aria-hidden="true">批量启用</i>
                                </button>
                            }
                            if (folderList.Contains("btnBatchForbid"))
                            {
                                <button id="btnBatchForbid" type="button" class="btn btn-primary">
                                    <i class="fa fa-group" aria-hidden="true">批量禁用</i>
                                </button>
                            }
                            if (folderList.Contains("btnProxy"))
                            {
                                <div class="form-group" style="margin-top:-2px;">
                                    <button id="btnProxy" class="btn btn-primary" type="button">
                                        <i class="fa fa-user"></i>&nbsp;代管配置
                                    </button>
                                </div>
                            }
                            if (folderList.Contains("btnResetPassWord"))
                            {
                                <div class="form-group" style="margin-top:-2px;">
                                    <button id="btnResetPassWord" class="btn btn-primary" type="button">
                                        <i class="fa fa-bars"></i>&nbsp;重置密码
                                    </button>
                                </div>
                            }
                            if (folderList.Contains("btnRecharge"))
                            {
                                <div class="form-group" style="margin-top:-2px;">
                                    <button id="btnRecharge" class="btn btn-primary" type="button">
                                        <i class="fa fa-cny"></i>&nbsp;给用户充值
                                    </button>
                                </div>
                            }
                        }
                    </div>
                    <div class="form-group form-inline" style="width:100%;">
                        @{
                            if (folderList.Contains("btnSearch"))
                            {
                                <div class="form-group">
                                    <input id="userName" name="userName" type="text" class="form-control" placeholder="用户名、登录名、手机号">
                                </div>
                                <div class="form-group" style="margin-top:-6px;width:200px;">
                                    <select id="orgUnit" name="orgUnit" title="请选择所属单位" data-live-search="true" class="form-control input-sm selectpicker" placeholder="请选择所属单位" style="padding: 5px 10px;">
                                        <option value="" selected>全部</option>
                                    </select>
                                </div>
                                <div class="form-group" style="margin-top:-6px;width:150px;">
                                    <select id="orgRole" name="orgRole" title="请选择角色" class="form-control input-sm selectpicker" placeholder="请选择角色" style="padding: 5px 10px;">
                                        <option value="" selected>全部</option>
                                    </select>
                                </div>
                                <div class="form-group" style="margin-top:-6px;width:100px;">
                                    <select id="orgStatus" name="orgStatus" title="请选择状态" class="form-control input-sm selectpicker" placeholder="请选择所属单位" style="padding: 5px 10px;">
                                        <option value="-1" selected>全部</option>
                                        <option value="1">启用</option>
                                        <option value="0">禁用</option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <input id="inDate" name="inDate" type="text" class="laydate-icon form-control input-sm" placeholder="起始注册日期" title="起始注册日期" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})"/>
                                </div>
                                <div class="form-group">
                                    <input id="outDate" name="outDate" type="text" class="laydate-icon form-control input-sm" placeholder="截止注册日期" title="截止注册日期" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})" />
                                </div>
                                <div class="form-group" style="margin-top:1px;">
                                    <button id="btnSearch" class="btn btn-primary" type="button"><i class="fa fa-search"></i>&nbsp;查询</button>
                                </div>
                            }
                        }
                    </div>
                </div>
                <table id="exampleTableToolbar" data-mobile-responsive="true" data-radio="true"></table>
            </div>
            <!-- End Example Toolbar -->
        </div>
    </div>
    <!-- End Panel Other -->
</div>
<!-- 单个：添加/编辑 -->
<div id="org_form" style="width: 460px; overflow: hidden; display: none;">
    <form class="form-horizontal m-t" id="orgFormTable" method="post">
            <div class="form-group">
                <label class="col-sm-3 control-label">用户名<span class="glyphicon glyphicon-asterisk requiredtitle"></span>：</label>
                <div class="col-sm-7">
                    <input id="user_name" name="user_name" type="text" autoComplete="off" class="form-control input-sm" placeholder="请输入用户名" title="请输入用户名" required="" aria-required="true" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">登录名<span class="glyphicon glyphicon-asterisk requiredtitle"></span>：</label>
                <div class="col-sm-7">
                    <input id="login_name" name="login_name" type="text" autoComplete="off" class="form-control input-sm" placeholder="请输入登录名" title="请输入登录名" required="" aria-required="true" />
                </div>
            </div>
            <div class="form-group" id="markPass">
                <label class="col-sm-3 control-label">密码<span class="glyphicon glyphicon-asterisk requiredtitle"></span>：</label>
                <div class="col-sm-7">
                    <input id="user_pwd" name="user_pwd" type="password" autoComplete="new-password" class="form-control input-sm" placeholder="请输入密码" title="请输入密码" required="" aria-required="true" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">性别<span class="glyphicon glyphicon-asterisk requiredtitle"></span>：</label>
                <div class="col-sm-7">
                    @*<select id=user_sex title="请选择性别" name="user_sex" class="selectpicker show-tick bs-select-hidden" data-live-search="false" required="" aria-required="true" placeholder="请选择性别">
                        <option value="男">男</option>
                        <option value="女">女</option>
                    </select>*@
                    <select id="user_sex" name="user_sex" title="请选择性别" class="form-control input-sm selectpicker" required="" aria-required="true" placeholder="请选择性别" style="padding: 5px 10px;">
                        <option value="男" selected>男</option>
                        <option value="女">女</option>
                    </select>
                </div>
            </div>
            @*<div id="userTypeSel" class="form-group">
                <label class="col-sm-3 control-label">用户类别：</label>
                <div class="col-sm-7">
                    <select id="user_type" name="user_type" title="请选择用户类别" class="form-control selectpicker" placeholder="请选择用户类别"></select>
                </div>
            </div>*@
            <div class="form-group">
                <label class="col-sm-3 control-label">状态<span class="glyphicon glyphicon-asterisk requiredtitle"></span>：</label>
                <div class="col-sm-7">
                    <select id="status" name="status" title="请选择状态" class="form-control input-sm selectpicker" required="" aria-required="true" placeholder="请选择状态" style="padding: 5px 10px;">
                        <option value="1" selected>启用</option>
                        <option value="0">禁用</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">使用类别<span class="glyphicon glyphicon-asterisk requiredtitle"></span>：</label>
                <div class="col-sm-7">
                    <select id="use_type" name="use_type" title="请选择使用类别" class="form-control input-sm selectpicker" required="" aria-required="true" placeholder="请选择使用类别" style="padding: 5px 10px;">
                        <option value="0" selected>账号登录</option>
                        <option value="1">扫码计时</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">所属单位：</label>
                <div class="col-sm-7">
                    <select id="unit_code" name="unit_code" title="请选择所属单位" data-live-search="true" class="form-control input-sm selectpicker" required="" aria-required="true" placeholder="请选择所属单位" style="padding: 5px 10px;">
                        <option value="" selected>空</option>
                    </select>
                    <input type="hidden" id="user_unit" name="user_unit" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">身份证：</label>
                <div class="col-sm-7">
                    <input id="user_identify" name="user_identify" type="text" class="form-control input-sm" placeholder="请输入身份证" title="请输入身份证" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">充值金额：</label>
                <div class="col-sm-7">
                    <input id="buy_gold" name="buy_gold" type="text" class="form-control input-sm" disabled="disabled" placeholder="请输入充值金额" title="请输入充值金额" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">赠送金额：</label>
                <div class="col-sm-7">
                    <input id="give_gold" name="give_gold" type="text" class="form-control input-sm" disabled="disabled" placeholder="请输入赠送金额" title="请输入赠送金额" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">机器绑定最大数<span class="glyphicon glyphicon-asterisk requiredtitle"></span>：</label>
                <div class="col-sm-7">
                    <input id="max_machine" name="max_machine" type="text" class="form-control input-sm" placeholder="0表示不限制" title="0表示不限制" required="" aria-required="true" value="0" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">QQ：</label>
                <div class="col-sm-7">
                    <input id="user_qq" name="user_qq" type="text" class="form-control input-sm" placeholder="请输入QQ" title="请输入QQ" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">电子邮件：</label>
                <div class="col-sm-7">
                    <input id="user_email" name="user_email" type="text" class="form-control input-sm" placeholder="请输入电子邮件" title="请输入电子邮件" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">生日：</label>
                <div class="col-sm-7">
                    <input id="user_birth" name="user_birth" type="text" class="laydate-icon form-control input-sm" placeholder="请输入生日" title="请输入生日" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})"/>

                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">电话号码：</label>
                <div class="col-sm-7">
                    <input id="user_phone" name="user_phone" type="text" class="form-control input-sm" placeholder="请输入电话号码" title="请输入电话号码" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">住址：</label>
                <div class="col-sm-7">
                    <textarea class="form-control" id="user_address" name="user_address" rows="3" placeholder="请输入住址信息" title="请输入住址信息"></textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-7">
                    <textarea class="form-control" id="user_note" name="user_note" rows="3" placeholder="请输入备注信息" title="请输入备注信息"></textarea>
                    <!--所属组织机构-->
                    <input type="hidden" id="orgUnits" name="orgUnits" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">用户编码：</label>
                <div class="col-sm-7">
                    <span id="user_guid" name="user_guid"></span>
                </div>
            </div>
</form>
</div>
<!-- 批量：添加/编辑 -->
<div id="batch_form" style="width: 460px; overflow: hidden; display: none;">
    <form class="form-horizontal m-t" id="batchFormTable" method="post">
        <div class="form-group">
            <label class="col-sm-12 control-label" style="color:red;font-weight:700;">登录名范围：以录入的用户/登录名前缀<span id="batchTitle"></span>开头至添加的个数截止</label>
        </div>
        <div class="form-group">
            <label class="col-sm-4 control-label">用户/登录名前缀<span class="glyphicon glyphicon-asterisk requiredtitle"></span>：</label>
            <div class="col-sm-8">
                <input id="loginUser" name="loginUser" type="text" autoComplete="off" class="form-control input-sm" placeholder="请输入用户/登录名前缀" title="请输入用户/登录名前缀" required="" aria-required="true" value="vrUser" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-4 control-label">批量添加个数<span class="glyphicon glyphicon-asterisk requiredtitle"></span>：</label>
            <div class="col-sm-8">
                <input id="userLen" name="userLen" type="text" class="form-control input-sm" placeholder="请输入创建个数，一次最多创建50个" title="请输入创建个数，一次最多创建50个" required="" aria-required="true" value="5" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-4 control-label">所属单位：</label>
            <div class="col-sm-8">
                <select id="unitCode" name="unitCode" title="请选择所属单位" data-live-search="true" class="form-control input-sm selectpicker" required="" aria-required="true" placeholder="请选择所属单位" style="padding: 5px 10px;">
                    <option value="" selected>空</option>
                </select>
                <!-- 所属单位代码 -->
                <input type="hidden" id="userUnit" name="userUnit" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-4 control-label">性别<span class="glyphicon glyphicon-asterisk requiredtitle"></span>：</label>
            <div class="col-sm-8">
                <select id="userSex" name="userSex" title="请选择性别" class="form-control input-sm selectpicker" required="" aria-required="true" placeholder="请选择性别" style="padding: 5px 10px;">
                    <option value="男" selected>男</option>
                    <option value="女">女</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-4 control-label">密码<span class="glyphicon glyphicon-asterisk requiredtitle"></span>：</label>
            <div class="col-sm-8">
                <input id="loginPwd" name="loginPwd" type="password" autoComplete="new-password" class="form-control input-sm" placeholder="请输入密码" title="请输入密码" required="" aria-required="true" />
            </div>
            <input id="buyGold" name="buyGold" type="hidden" value="0" />
            <input id="giveGold" name="giveGold" type="hidden" value="0" />
        </div>
        <div class="form-group">
            <label class="col-sm-4 control-label">机器绑定最大数<span class="glyphicon glyphicon-asterisk requiredtitle"></span>：</label>
            <div class="col-sm-8">
                <input id="maxMachine" name="maxMachine" type="text" class="form-control input-sm" placeholder="0表示不限制" title="0表示不限制" required="" aria-required="true" value="0" />
            </div>
        </div>
    </form>
</div>
<!--重置密码-->
<div id="orgPassWord" style="width: 460px; overflow: hidden; display: none;">
    <form class="form-horizontal m-t" id="orgFormPassWord" method="post" style="padding-bottom:20px;">
        <div class="form-group">
            <label class="col-sm-3 control-label">密码<span class="glyphicon glyphicon-asterisk requiredtitle"></span>：</label>
            <div class="col-sm-7">
                <input id="user_pwd" name="user_pwd" type="password" class="form-control input-sm" placeholder="请输入密码" title="请输入密码" required="" aria-required="true" />
                <input type="hidden" id="user_name" name="user_name" value="" />
                <input type="hidden" id="login_name" name="login_name" value="" />
                <input type="hidden" id="user_id" name="user_id" value="" required="" aria-required="true" />
            </div>
        </div>
    </form>
</div>
<!-- Excel 导入用户 -->
<div id="import_form" style="width: 460px;height:100%; overflow: hidden; display: none;">
    <form class="form-horizontal m-t" id="importFormTable" enctype="multipart/form-data">
        <div class="form-group">
            <label class="col-sm-3 control-label">用户文件<span class="glyphicon glyphicon-asterisk requiredtitle"></span>：</label>
            <div class="col-sm-8">
                <input id="excelFile" name="excelFile" type="file" accept=".xlsx" fileId="BusinessLicenseImg" attribute="src" class="form-control input-sm files" placeholder="请选择导入文件上传">
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-10 col-sm-offset-3">
                <a class="btn btn-primary btn-sm" href="~/Resources/excel/用户导入模板.xlsx">
                    <span class="glyphicon glyphicon-download"></span>
                    下载excel模板
                </a>
            </div>
        </div>
    </form>
</div>
<!--给用户充值-->
<div id="orgPayUser" style="width: 460px; overflow: hidden; display: none;">
    <form class="form-horizontal m-t" id="orgFormPayUser" method="post" style="padding-bottom:20px;">
        <div class="form-group">
            <label class="col-sm-4 control-label">V金币数额：</label>
            <div class="col-sm-7">
                <input id="paybuyGold" name="paybuyGold" type="text" class="form-control input-sm" onkeyup="help.int('paybuyGold')" value="0" placeholder="请输入金币数额" title="请输入金币数额" />
                <input type="hidden" id="user_id" name="user_id" value="" required="" aria-required="true" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-4 control-label">赠送金币数额：</label>
            <div class="col-sm-7">
                <input id="paygiveGold" name="paygiveGold" type="text" class="form-control input-sm" onkeyup="help.int('paygiveGold')" value="0" placeholder="请输入赠送金币数额" title="请输入赠送金币数额" />
            </div>
        </div>
    </form>
</div>
    @section footSection{
        <script src="~/Resources/mainFrame/js/plugins/prettyfile/bootstrap-prettyfile.js"></script>
        <script src="~/Resources/mainFrame/js/plugins/treeview/v1.2.0/bootstrap-treeview.js"></script>
        <script src="~/Resources/tools/treeview-search-custom.js"></script>
        <script src="~/Resources/myScript/SysUser/userManager.js"></script>
        <script>
            var UserType,areaCode;
            $(function () {
                UserType="@ViewBag.UserType";
                areaCode=@ViewBag.areaCode;
                //初始化Page
                userManager.initPage();
            });
        </script>
    }
